package com.yijdn.common.utils;

import com.yijdn.common.service.LocaleMessageSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

import java.util.Locale;

/**
 * @author zww
 * @date 2018-03-25 11:16
 * <p>
 * Email 971762302@qq.com
 * <p>
 * Describe:
 */

public class MessageUtils {
    private static LocaleMessageSourceService messageSource;

    static {
        messageSource = SpringContextUtils.getBean("localeMessageSourceService",LocaleMessageSourceService.class);
    }

    public static String getMsg(String key){
        String message = messageSource.getMessage("success");
        return message;
    }
}
